﻿using DevExpress.XtraEditors;
using DXApplicationTangche.UC.下单MTO;
using DXApplicationTangche.UC.抖音出入库.Service;
using DXApplicationTangche.UC.抖音出入库.抖音下单;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.客户CRM.高德
{
    public partial class Form抖音客户一览 : DevExpress.XtraEditors.XtraForm
    {
        private List<DouyinAddressQueryDTO> douyinAddressQueryDTOs = new List<DouyinAddressQueryDTO>();
        public Form抖音客户一览()
        {
            InitializeComponent();
            this.refresh();
        }

        private void simpleButton新增客户_Click(object sender, EventArgs e)
        {
            new Form高德新建客户地址().ShowDialog();
            this.refresh();
        }

        private void refresh()
        {
            this.douyinAddressQueryDTOs = 抖音Service.getDouyinUserAddressInfoAll("SSHIRT", "18");
            this.gridControl抖音客户一览.DataSource = this.douyinAddressQueryDTOs;
            this.gridView抖音客户一览.RefreshData();
        }

        private void 修改客户地址ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                String mobile = this.gridView抖音客户一览.GetRowCellValue(this.gridView抖音客户一览.FocusedRowHandle, "mobile").ToString();
                foreach (DouyinAddressQueryDTO item in this.douyinAddressQueryDTOs)
                {
                    if (mobile.Equals(item.mobile))
                    {
                        new Form高德新建客户地址(item).ShowDialog();
                        break;
                    }
                }
                this.refresh();
            }
            catch { }
        }

    }
}